import java.util.HashSet;
import java.util.Set;

/**
 * The type My set.
 */
public class MySet {
    private Set<Integer> setData;

    /**
     * Instantiates a new My set.
     */
    public MySet() {
        setData = new HashSet<Integer>();
    }

    /**
     * Instantiates a new My set.
     *
     * @param setData the set data
     */
    public MySet(HashSet<Integer> setData) {
        this.setData = setData;
    }

    /**
     * Gets set data.
     *
     * @return the set data
     */
    public Set<Integer> getSetData() {
        return setData;
    }

    /**
     * Sets set data.
     *
     * @param setData the set data
     */
    public void setSetData(Set<Integer> setData) {
        this.setData = setData;
    }

    /**
     * Print set.
     */
    public void printSet(){
        System.out.println(this.setData);
    }

    /**
     * Add to set.
     *
     * @param n the n
     */
    public void addToSet(int n){
        setData.add(n);
    }

    /**
     * Is set empty boolean.
     *
     * @return the boolean
     */
    public boolean isSetEmpty(){
        return setData.isEmpty();
    }

    /**
     * Get cardinality int.
     *
     * @return the int
     */
    public int getCardinality(){
        return setData.size();
    }

    /**
     * Is in set boolean.
     *
     * @param x the number
     * @return the boolean
     */
    public boolean isInSet(int x){
        return setData.contains(x);
    }

    /**
     * Clear.
     */
    public void clear(){
        setData.clear();
    }

    /**
     * Intersection my set.
     *
     * @param SetB the set b
     * @return the my set
     */
    public MySet intersection(MySet SetB){
        HashSet<Integer> intersectionSet = new HashSet<>(setData);
        intersectionSet.retainAll(SetB.getSetData());
        return new MySet(intersectionSet);
    }
}
